package com.litengsoft.lianmeng.service.impl;

import com.litengsoft.lianmeng.service.LocalCacheService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 本地缓存
 */
@Service("localCacheService")
public class LocalCacheServiceImpl implements LocalCacheService {


    public static Map<String, String> localCache = new HashMap<>();

    /**
     * 向缓存中设置value
     * @param map
     */
    @Override
    public void putAll(Map<String, String> map) {
        localCache.putAll(map);
    }

    /**
     * 向缓存中设置value
     * @param key
     * @param value
     */
    @Override
    public void put(String key, String value) {
        localCache.put(key, value);
    }

    /**
     * 获取缓存中的value
     * @param key
     * @return
     */
    @Override
    public Object get(String key) {
        return localCache.get(key);
    }

}
